package hot100;

public class maxArea2 {
    public int maxArea(int[] height) {
        int left = 0;
        int right = height.length - 1;
        int total = 0;
        while(left < right) {
            int min = Math.min(height[left],height[right]);
            total = Math.max(total,(right - left)*min);
            if(height[left] < height[right]) {
                left++;
            }else {
                right--;
            }
        }
        return total;
    }
}
